A class is a template for objects, and an object is an instance of class.
A constructor allows you to initialize an object's properties upon creation of the object. If you create a __construct() function, PHP will automatically call this function when you create an object from a class.
As constructors and destructors helps reducing the amount of code, they are very useful!
Properties and methods can have access modifiers which control where they can be accessed.
Inheritance in OOP = When a class derives from another class. The child class will inherit all the public and protected properties and methods from the parent class. In addition, it can have its own properties and methods. An inherited class is defined by using the extends keyword.
Inherited methods can be overridden by redefining the methods (use the same name) in the child class.
The final keyword can be used to prevent class inheritance or to prevent method overriding.
Constants cannot be changed once it is declared. Class constants can be useful if you need to define some constant data within a class. A class constant is declared inside a class with the const keyword. Class constants are case-sensitive. However, it is recommended to name the constants in all uppercase letters.
Abstract classes and methods are when the parent class has a named method, but need its child class(es) to fill out the tasks. Interfaces are declared with the interface keyword:
Interfaces allow you to specify what methods a class should implement. Interfaces make it easy to use a variety of different classes in the same way. When one or more classes use the same interface, it is referred to as "polymorphism". Interfaces are declared with the interface keyword:
Static methods can be called directly - without creating an instance of the class first.
Static properties can be called directly - without creating an instance of a class.
An iterable is any value which can be looped through with a foreach() loop.
All arrays are iterables, so any array can be used as an argument of a function that requires an iterable. Iterators: Any object that implements the Iterator interface can be used as an argument of a function that requires an iterable.